package com.apes.fn.controlling.vehicle.model;

import com.alibaba.fastjson.annotation.JSONField;
import com.apes.framework.jpa.ApesBean;
import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.comment.Comment;
import com.apes.framework.jpa.generator.ApesGenerator;
import com.apes.framework.util.ApesConst;
import com.apes.framework.util.DateUtil;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;
import java.util.Date;

/**
 * Creator: zouyc
 * CreateDate: 2021-03-22 14:17
 * Description:
 **/
@Getter
@Setter
@SelectBeforeUpdate
@DynamicInsert
@DynamicUpdate
@Entity
@EntityListeners(DefaultPersistListener.class)
@Table(name = VehicleInfoCombine.CONST_TABLE_NAME, indexes = {
        @Index(columnList = "end")
})
public class VehicleInfoCombine implements ApesBean {
    public static final String CONST_TABLE_NAME = "vehicle_info_combine";

    @Id
    @Column(name = "id", length = 32)
    @ApesGenerator(code = CONST_TABLE_NAME, name = "车辆服务信息主表编码")
    @Comment("编号")
    private String id;

    @Column(name = "end", nullable = false, columnDefinition = "number(1,0) default 0")
    @Comment("是否完结")
    private boolean end = false;

    @Column(name = "dept_id", length = 256)
    @Comment("门店编码")
    private String deptId;

    @Column(name = "dept_name", length = 2000)
    @Comment("门店名称")
    private String deptName;

    @Column(name = "work_platform", length = 2000)
    @Comment("施工端编码列表")
    private String workPlatform;

    @Column(name = "work_platform_name", length = 2000)
    @Comment("施工端名称列表")
    private String workPlatformName;

    //和车辆相关
    @Column(name = "fn_customer_expand_id", length = 2000)
    @Comment("车辆扩展表编码")
    private String fnCustomerExpandId;

    @Column(name = "car_license", length = 2000)
    @Comment("车牌号码")
    private String carLicense;

    @Column(name = "mobile", length = 2000)
    @Comment("用户手机号")
    private String mobile;

    @Column(name = "JEKUN_MODEL_CODE", length = 2000)
    @Comment("车保车型编码")
    private String jekunCode;

    @Column(name = "brand_id", length = 2000)
    @Comment("品牌编码")
    private String brandId;

    @Column(name = "brand_name", length = 2000)
    @Comment("品牌名称")
    private String brandName;

    //和接车相关
    @Column(name = "pick_car_id", length = 255)
    @Comment("接车单号")
    private String pickCarId;

    @Column(name = "pick_car_uid", length = 255)
    @Comment("接车人编码")
    private String pickCarUId;

    @Column(name = "pick_car_uname", length = 255)
    @Comment("接车人名称")
    private String pickCarUName;

    @JSONField(format = DateUtil.SHOW_DATETIME_FORMAT)
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "pick_car_time")
    @Comment("接车时间")
    private Date pickCarTime;

    @JSONField(format = DateUtil.SHOW_DATETIME_FORMAT)
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "return_car_time")
    @Comment("还车时间")
    private Date returnCarTime;

    @JSONField(format = DateUtil.SHOW_DATETIME_FORMAT)
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "estimate_date")
    @Comment("预计交车时间")
    private Date estimateDate;

    @Column(name = "car_model_label", length = 256)
    @Comment("配置车型名称")
    private String carModelLabel;

    @Column(name = "vip_level", length = 255)
    @Comment("会员等级名称")
    private String vipLevel;

    @Column(name = "vip_liveness", length = 255)
    @Comment("会员活跃度名称")
    private String vipLiveness;

    @Column(name = "vip_level_id", length = 255)
    @Comment("会员等级编码")
    private String vipLevelId;

    @Column(name = "vip_liveness_id", length = 255)
    @Comment("会员活跃度编码")
    private String vipLivenessId;

    @Column(name = "serve_type", length = 255)
    @Comment("服务类型名称")
    private String serveType;

    @Column(name = "serve_type_id", length = 255)
    @Comment("服务类型编码")
    private String serveTypeId;

//    @Column(name = "beyond_time", nullable = false, columnDefinition = "number(1,0) default 0")
//    @Comment("是否超时[接车时间-交车时间-预计时间的比较]")
//    private boolean beyondTime = false;

//    @Column(name = "consume_time", nullable = false, columnDefinition = ApesConst.FIELD_QTY_16_4_0)
//    @Comment("消耗时间[如果不为空，则说明完成本次接还车]")
//    private Double consumeTime;
//
//    @Column(name = "consume_time_show", length = 255)
//    @Comment("消耗时间展示")
//    private String consumeTimeShow;
}
